package com.springboot.rigger.modules.service;

import com.springboot.rigger.modules.dao.JifenDao;
import com.springboot.rigger.modules.entity.Jifen;
import com.springboot.rigger.modules.entity.JifenType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description:
 * @title: JifenServiceImpl
 * @Author Star_Chen
 * @Date: 2023/10/17 11:12
 * @Version 1.0
 */
@Service
public class JifenServiceImpl implements JifenService {

    @Autowired
    private JifenDao jifenDao;

    @Override
    public int insert(Jifen jifen) {
        return 0;
    }

    @Override
    public int insert() {
        String[] str = {"张三", "李四", "王五", "赵六", "孙七"};
        JifenType jifenType = JifenType.randomType(JifenType.values());
        return jifenDao.insert(new Jifen(jifenType.name, (int) (Math.random() * (23 - 6) + 6), jifenType.id, str[(int) (Math.random() * str.length)]));
    }
}
